# Dickstein, Ho, and Mark (2022)
# Run this program to execute all of the programs in the data_construction folder in the correct order.
# Only programs are included in this folder. These programs use data in the data/orig folder and create 
# new data sets which are saved in the data folder. 

module load R/4.0.2

# Create the choice set and household/subscriber level dataset:
Rscript AD01*
Rscript AC01*

# Create the small group switcher sample: 
Rscript BL01*
## Note: ^this file also creates two tables that are saved in the analysis folder. 

# Create a dataset with the estimated number of uninsured in each group: 
cd uninsurance_rate
bash 0_run_all.sh
cd ..

# Create a household/subscriber level dataset including uninsured households:
Rscript AC02*

# Create a household/subscriber-insurance option level datasetset:
Rscript AC03*
Rscript AC04*

# Create the household/subscriber level dataset used in the counterfactuals
Rscript DE01*

# Create a household/subscriber-insurance option level datasetset for the small group:
Rscript AC05*

# Create the choice set and household/subscriber level dataset for the post-merger counterfactual sample: 
Rscript DA001*